<!-- 确认到货 -->
<div class="float-confirm float-confirm-dialog js_doneDealerOrderDiv" style="z-index: 20000;display: none; width:auto;">
    <div class="float-confirm-con">
        <h2 class="fs22 blue2 line">请填写确认到货备注</h2>
        <div class="line" style="width:500px;height:auto;margin-bottom:15px;">
            <table style="line-height:50px;" class="js_expressTable">
                <tr>
                    <td>确认到货备注(必填)：</td>
                    <td style="min-width:400px;">
                        <textarea class="add-f-area textarea_box js_receiverExtra"></textarea>
                    </td>
                </tr>
            </table>
        </div>
        <div class="float-confirm-btns" style="padding-bottom:30px;">
            <a class="btn btn-default btn-sm right js_cancel" href="javascript:void(0);">取消</a>
            <a class="btn btn-success btn-sm right js_confirm" href="javascript:void(0);">确定</a>
        </div>
    </div>
</div>
<script>
    (function ($) {

        var el = $('.js_doneDealerOrderDiv');
        var nodes = {
            extra: el.find('.js_receiverExtra')
        };

        var done = function (order_id) {
            nodes.extra.val('');
            showConfirmDiv(el, order_id);
            $.pageMask.show();
        };

        // 确认到货显示
        $('.js_doneDealerOrderBtn').click(function () {
            var order_id = $(this).closest('tr').data('id');
            done(order_id);
        });

        // 确认到货操作
        el.find('.js_confirm').click(function () {
            var extra = $.trim(nodes.extra.val());

            var order_id = el.data('id');
            var params = {
                order_id: order_id
            };

            if (!extra) {
                showMsg('确认到货备注不能为空!');
                nodes.extra.effect('highlight');
                return;
            }
            params.extra = extra;

            $.post(
                    "{AnUrl('order/admin/operation/dealer_action_done')}",
                    params,
                    function (ret) {
                        if (ret && ret.flag === 0) {
                            showMsg(ret.message);
                            setTimeout(function () {
                                window.location.reload();
                            }, 1500);
                            return;
                        }
                        showMsg(ret.message || "接口请求失败, 请稍后重试");
                        el.hide();
                        $.pageMask.hide();
                    }
            );
        });

        // 注册到全局操作
        window.order_operation.DEALER_ACTION_DONE = done;
        console.log('order_operation.DEALER_ACTION_DONE added! 确认到货');
    })(jQuery);
</script>
<!-- /确认到货 -->